(* Content-type: application/mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 7.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       145,          7]
NotebookDataLength[     21170,        612]
NotebookOptionsPosition[     20065,        577]
NotebookOutlinePosition[     20427,        593]
CellTagsIndexPosition[     20384,        590]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[{
 RowBox[{
  RowBox[{
  "SetDirectory", "[", "\"\<C:\\\\Users\\\\jing\\\\Desktop\\\\Gazou\>\"", 
   "]"}], " "}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"$Path", "=", 
    RowBox[{"Append", "[", 
     RowBox[{
     "$Path", ",", "\"\<C:\\\\Users\\\\jing\\\\Desktop\\\\Gazou\>\""}], 
     "]"}]}], " ", ";"}], "  "}], "\[IndentingNewLine]", 
 RowBox[{"<<", "KMeanPlus`"}]}], "Input",
 CellChangeTimes->{{3.497921985236554*^9, 3.497921993271014*^9}, 
   3.4979220326882687`*^9}],

Cell[BoxData[{
 RowBox[{"imagetarget", "=", 
  RowBox[{
  "Import", "[", "\"\<picture002.jpg\>\"", "]"}]}], "\[IndentingNewLine]", 
 RowBox[{" ", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{"rtarget", ",", "gtarget", ",", "btarget"}], "}"}], "=", 
   RowBox[{"ColorSeparate", "[", "imagetarget", "]"}]}]}], "\n", 
 RowBox[{
  RowBox[{"raux", "=", 
   RowBox[{
    RowBox[{"ColorSeparate", "[", 
     RowBox[{"Import", "[", "\"\<picture003.jpg\>\"", "]"}], "]"}], "//", 
    "First"}]}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", 
 RowBox[{" ", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{"htarget", ",", "starget", ",", "vtarget"}], "}"}], "=", 
   RowBox[{"ColorSeparate", "[", 
    RowBox[{"ColorConvert", "[", 
     RowBox[{"imagetarget", ",", "\"\<HSB\>\""}], "]"}], 
    "]"}]}]}], "\n"}], "Input",
 CellChangeTimes->{{3.4982827774566383`*^9, 3.4982827908102612`*^9}, {
  3.498282820840314*^9, 3.4982828948936443`*^9}, {3.498284933754825*^9, 
  3.498284977356902*^9}, {3.498285066729459*^9, 3.4982851035299234`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"(*", 
   RowBox[{"Function", " ", "Definition"}], "*)"}], " ", 
  "\[IndentingNewLine]", 
  RowBox[{
   RowBox[{"Feature1Dmono", "[", 
    RowBox[{"monochromeimage_", ",", "l_"}], "]"}], ":=", 
   RowBox[{"Module", "[", 
    RowBox[{
     RowBox[{"{", 
      RowBox[{
      "imagedata", ",", "w", ",", "h", ",", "arrayrules", ",", "offsetmat", 
       ",", "untrimmed2D", ",", "feature1D"}], "}"}], ",", " ", 
     "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{"(", 
       RowBox[{"imagedata", "=", 
        RowBox[{"monochromeimage", "//", "ImageData"}]}], ")"}], ";", " ", 
      "\[IndentingNewLine]", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{"w", ",", "h"}], "}"}], "=", 
       RowBox[{"imagedata", "//", "Dimensions"}]}], ";", " ", 
      "\[IndentingNewLine]", 
      RowBox[{
       RowBox[{
        RowBox[{"(", 
         RowBox[{"arrayrules", "=", 
          RowBox[{
           RowBox[{"imagedata", "//", 
            RowBox[{
             RowBox[{"ArrayRules", "[", 
              RowBox[{"#", ",", 
               RowBox[{"-", "1"}]}], "]"}], "&"}]}], "//", "Most"}]}], ")"}], 
        "//", "Length"}], "//", "Print"}], ";", " ", "\[IndentingNewLine]", 
      RowBox[{"(", 
       RowBox[{"offsetmat", "=", 
        RowBox[{"Table", "[", 
         RowBox[{
          RowBox[{
           RowBox[{"(", 
            RowBox[{
             RowBox[{"Function", "[", 
              RowBox[{"x", ",", 
               RowBox[{"MapAt", "[", 
                RowBox[{
                 RowBox[{
                  RowBox[{"#", "+", 
                   RowBox[{"{", 
                    RowBox[{"i", ",", "j"}], "}"}]}], "&"}], ",", "x", ",", 
                 "1"}], "]"}]}], "]"}], "/@", "arrayrules"}], ")"}], "//", 
           "\[IndentingNewLine]", 
           RowBox[{
            RowBox[{"SparseArray", "[", 
             RowBox[{"#", ",", 
              RowBox[{"{", 
               RowBox[{
                RowBox[{"w", "+", 
                 RowBox[{"2", "l"}]}], ",", 
                RowBox[{"h", "+", 
                 RowBox[{"2", "l"}]}]}], "}"}], ",", 
              RowBox[{"-", "1"}]}], "]"}], "&"}]}], ",", 
          RowBox[{"{", 
           RowBox[{"i", ",", "0", ",", 
            RowBox[{"2", "l"}]}], "}"}], ",", 
          RowBox[{"{", 
           RowBox[{"j", ",", "0", ",", 
            RowBox[{"2", "l"}]}], "}"}]}], "]"}]}], ")"}], ";", " ", 
      "\[IndentingNewLine]", 
      RowBox[{
       RowBox[{
        RowBox[{"(", 
         RowBox[{"untrimmed2D", "=", 
          RowBox[{
           RowBox[{"offsetmat", "//", "Normal"}], "//", 
           RowBox[{
            RowBox[{"Transpose", "[", 
             RowBox[{"#", ",", 
              RowBox[{"{", 
               RowBox[{"3", ",", "4", ",", "1", ",", "2"}], "}"}]}], "]"}], 
            "&"}]}]}], ")"}], "//", "Dimensions"}], "//", "Print"}], ";", " ",
       "\[IndentingNewLine]", 
      RowBox[{"(", 
       RowBox[{"feature1D", "=", 
        RowBox[{"Flatten", "/@", 
         RowBox[{"Cases", "[", 
          RowBox[{"untrimmed2D", ",", 
           RowBox[{"x_", "/;", 
            RowBox[{
             RowBox[{"x", "[", 
              RowBox[{"[", 
               RowBox[{
                RowBox[{"l", "+", "1"}], ",", 
                RowBox[{"l", "+", "1"}]}], "]"}], "]"}], "\[NotEqual]", " ", 
             RowBox[{"-", "1"}]}]}], ",", 
           RowBox[{"{", "2", "}"}]}], "]"}]}]}], ")"}]}]}], " ", 
    "\[IndentingNewLine]", "]"}]}]}]], "Input"],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"ImageData", "[", "rtarget", "]"}], "//", "Dimensions"}], 
  "\n"}]], "Input",
 CellChangeTimes->{{3.497922192720422*^9, 3.4979221948115416`*^9}}],

Cell[BoxData[
 RowBox[{"hsv", "//", "Dimensions"}]], "Input",
 CellChangeTimes->{{3.497922199768825*^9, 3.4979222035200396`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"(", 
   RowBox[{"feature1Dmono", "=", 
    RowBox[{"Feature1Dmono", "[", 
     RowBox[{
      RowBox[{
       RowBox[{"ImageData", "[", "rtarget", "]"}], "//", "Image"}], ",", 
      RowBox[{"l", "=", "1"}]}], "]"}]}], ")"}], "//", 
  "Dimensions"}]], "Input",
 CellChangeTimes->{{3.4979221469078016`*^9, 3.497922171446205*^9}, {
  3.4979223259260406`*^9, 3.497922340876896*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"(", 
   RowBox[{"feature1DmonoAux", "=", 
    RowBox[{"Feature1Dmono", "[", 
     RowBox[{
      RowBox[{
       RowBox[{"ImageData", "[", "raux", "]"}], "//", "Image"}], ",", 
      RowBox[{"l", "=", "1"}]}], "]"}]}], ")"}], "//", 
  "Dimensions"}]], "Input",
 CellChangeTimes->{{3.498282918652486*^9, 3.498282927653702*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"Map", "[", 
    RowBox[{
     RowBox[{
      RowBox[{"#", "[", 
       RowBox[{"[", "5", "]"}], "]"}], "&"}], ",", 
     RowBox[{"(", 
      RowBox[{"feature1DmonoAux", "//", 
       RowBox[{
        RowBox[{"Partition", "[", 
         RowBox[{"#", ",", "640"}], "]"}], "&"}]}], ")"}], ",", 
     RowBox[{"{", "2", "}"}]}], "]"}], "//", "Image"}], "//", 
  RowBox[{
   RowBox[{"Show", "[", 
    RowBox[{"#", ",", 
     RowBox[{"ImageSize", "\[Rule]", " ", "400"}]}], "]"}], "&"}]}]], "Input",
 CellChangeTimes->{{3.4982830276654773`*^9, 3.4982830282426786`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{
    RowBox[{"(", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{"means", ",", "dmatrix", ",", "pdata", ",", "obj"}], "}"}], 
      "=", 
      RowBox[{"KPPRepeati", "[", 
       RowBox[{"feature1Dmono", ",", 
        RowBox[{"KPPInit", "[", 
         RowBox[{"feature1Dmono", ",", 
          RowBox[{"k", "=", "12"}]}], "]"}], ",", 
        RowBox[{"repeat", "=", "8"}]}], "]"}]}], "\[IndentingNewLine]", ")"}],
     "//", "Timing"}], "//", "First"}], "\[IndentingNewLine]"}]], "Input",
 CellChangeTimes->{{3.497922392363841*^9, 3.4979223979361596`*^9}, {
  3.497922558898366*^9, 3.4979225674038525`*^9}, {3.497922601723816*^9, 
  3.4979226628703127`*^9}}],

Cell[BoxData[
 RowBox[{"obj", "//", 
  RowBox[{
   RowBox[{"Export", "[", 
    RowBox[{"\"\<rtarget-obj.txt\>\"", ",", 
     RowBox[{"#", "//", "ToString"}], ",", "\"\<Text\>\""}], "]"}], 
   "&"}]}]], "Input",
 CellChangeTimes->{{3.4979237646703324`*^9, 3.497923825689822*^9}, {
  3.4979239863290105`*^9, 3.4979239919163303`*^9}, {3.497924038582999*^9, 
  3.497924043549283*^9}, {3.497924647778843*^9, 3.4979246620156574`*^9}, {
  3.497924913612048*^9, 3.497924917864291*^9}, {3.497925684706152*^9, 
  3.497925706714411*^9}, {3.4979258363068233`*^9, 3.497925838137928*^9}, {
  3.497925910826085*^9, 3.4979259139422636`*^9}, {3.4979260117228565`*^9, 
  3.497926033690113*^9}, {3.4979260695751653`*^9, 3.497926075355496*^9}, {
  3.4979261664037037`*^9, 3.4979261719940233`*^9}, {3.49792621302337*^9, 
  3.4979262239029922`*^9}}],

Cell[BoxData[{
 RowBox[{
  RowBox[{"(", 
   RowBox[{"means", "=", 
    RowBox[{
     RowBox[{"Import", "[", 
      RowBox[{"\"\<rtarget-cen.txt\>\"", ",", "\"\<Text\>\""}], "]"}], "//", 
     "ToExpression"}]}], " ", ")"}], "//", 
  "Dimensions"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"(", 
   RowBox[{"targetdmatrix", "=", 
    RowBox[{
     RowBox[{"Import", "[", 
      RowBox[{"\"\<rtarget-dm.txt\>\"", ",", "\"\<Text\>\""}], "]"}], "//", 
     "ToExpression"}]}], " ", ")"}], "//", 
  "Dimensions"}], "\[IndentingNewLine]"}], "Input",
 CellChangeTimes->{{3.4979240035399947`*^9, 3.49792406185933*^9}, {
  3.4979241082369833`*^9, 3.497924111908193*^9}, {3.497924641174465*^9, 
  3.497924671907223*^9}, {3.4979247349578295`*^9, 3.4979247364269133`*^9}, {
  3.4979252496172667`*^9, 3.497925251334365*^9}, {3.497925956432694*^9, 
  3.4979259577587695`*^9}, {3.4979260077406282`*^9, 3.4979260089656987`*^9}, {
  3.497926039793462*^9, 3.4979260414625573`*^9}, {3.4979260818688684`*^9, 
  3.497926083345953*^9}, {3.4979261796674623`*^9, 3.4979261810225396`*^9}, {
  3.498283105384814*^9, 3.498283112248826*^9}, {3.4982838238752756`*^9, 
  3.498283840021304*^9}}],

Cell[BoxData[
 RowBox[{"?", "KPPRepeati"}]], "Input",
 CellChangeTimes->{{3.497922406383643*^9, 3.4979224079387317`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"(", 
   RowBox[{"distmatrix", "=", 
    RowBox[{"Outer", "[", 
     RowBox[{
     "EuclideanDistance", ",", "feature1DmonoAux", ",", "means", ",", "1"}], 
     "]"}]}], ")"}], "//", "MatrixPlot"}]], "Input",
 CellChangeTimes->{{3.4982830601759343`*^9, 3.4982831553361015`*^9}, {
  3.4982832873591337`*^9, 3.498283292132742*^9}, {3.498283860051739*^9, 
  3.4982838779761705`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"ordering", "=", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{
      RowBox[{"First", "[", 
       RowBox[{"Ordering", "[", "#", "]"}], "]"}], "&"}], "/@", 
     "distmatrix"}], ")"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.4982831998273797`*^9, 3.4982832117614007`*^9}, {
  3.498283249965868*^9, 3.498283281446723*^9}, {3.4982833174983864`*^9, 
  3.4982833409920273`*^9}, {3.498283438710599*^9, 3.4982834643414445`*^9}, {
  3.4982835062743177`*^9, 3.4982835112195263`*^9}}],

Cell[BoxData[{
 RowBox[{"dim", "=", 
  RowBox[{"Dimensions", "@", "distmatrix"}]}], "\[IndentingNewLine]", 
 RowBox[{"Length", "/@", 
  RowBox[{"(", 
   RowBox[{"distc", "=", 
    RowBox[{"Table", "[", 
     RowBox[{
      RowBox[{
       RowBox[{"Pick", "[", 
        RowBox[{"distmatrix", ",", "ordering", ",", "i"}], "]"}], "[", 
       RowBox[{"[", 
        RowBox[{"All", ",", "i"}], "]"}], "]"}], ",", 
      RowBox[{"{", 
       RowBox[{"i", ",", "1", ",", 
        RowBox[{"Last", "@", "dim"}]}], "}"}]}], "]"}]}], ")"}]}]}], "Input",
 CellChangeTimes->{{3.498283495650699*^9, 3.4982835211099443`*^9}, {
  3.4982835780968437`*^9, 3.4982835887516627`*^9}, {3.498283644896161*^9, 
  3.4982836623369923`*^9}, {3.498283694207848*^9, 3.4982837474351416`*^9}, {
  3.498529215991731*^9, 3.4985292588450065`*^9}}],

Cell[BoxData[{
 RowBox[{
  RowBox[{
   RowBox[{"targetordering", "=", 
    RowBox[{"(", 
     RowBox[{
      RowBox[{
       RowBox[{"First", "[", 
        RowBox[{"Ordering", "[", "#", "]"}], "]"}], "&"}], "/@", 
      "targetdmatrix"}], ")"}]}], ";"}], " "}], "\[IndentingNewLine]", 
 RowBox[{"Length", "/@", 
  RowBox[{"(", 
   RowBox[{"targetdistc", "=", 
    RowBox[{"Table", "[", 
     RowBox[{
      RowBox[{
       RowBox[{"Pick", "[", 
        RowBox[{"targetdmatrix", ",", "targetordering", ",", "i"}], "]"}], 
       "[", 
       RowBox[{"[", 
        RowBox[{"All", ",", "i"}], "]"}], "]"}], ",", 
      RowBox[{"{", 
       RowBox[{"i", ",", "1", ",", 
        RowBox[{"Last", "@", "dim"}]}], "}"}]}], "]"}]}], ")"}]}]}], "Input",
 CellChangeTimes->{{3.498283890674593*^9, 3.498283947708293*^9}, {
  3.498529269889826*^9, 3.498529272947431*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"(", 
   RowBox[{
    RowBox[{
     RowBox[{"{", 
      RowBox[{"distc", ",", "targetdistc"}], "}"}], "//", "Transpose"}], "//", 
    RowBox[{
     RowBox[{"Histogram", "/@", "#"}], "&"}]}], ")"}], "//", 
  "GraphicsColumn"}]], "Input",
 CellChangeTimes->{
  3.4982838159036617`*^9, {3.4982840354428473`*^9, 3.4982841313050156`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"<<", "MannWhitney`"}], "\[IndentingNewLine]"}]], "Input",
 CellChangeTimes->{{3.4982842872584896`*^9, 3.498284292515699*^9}, 
   3.4985287562433233`*^9}],

Cell[BoxData[{
 RowBox[{
  RowBox[{
   RowBox[{"nsample", "=", "1000"}], ";"}], " "}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"(", 
    RowBox[{"auxselectdistc", "=", 
     RowBox[{"MapThread", "[", "\[IndentingNewLine]", 
      RowBox[{
       RowBox[{
        RowBox[{"Pick", "[", 
         RowBox[{"#1", ",", 
          RowBox[{"Map", "[", 
           RowBox[{
            RowBox[{"Function", "[", 
             RowBox[{"x", ",", 
              RowBox[{"x", "<", "#2"}]}], "]"}], ",", "#1"}], "]"}]}], "]"}], 
        "&"}], "\[IndentingNewLine]", ",", 
       RowBox[{"{", 
        RowBox[{"distc", ",", 
         RowBox[{"Max", "/@", "targetdistc"}]}], "}"}]}], 
      "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", ")"}], "//", 
   "Timing"}], "//", 
  RowBox[{
   RowBox[{"MapAt", "[", 
    RowBox[{"Dimensions", ",", "#", ",", 
     RowBox[{"-", "1"}]}], "]"}], "&"}]}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"(", 
   RowBox[{"randomsamples", "=", 
    RowBox[{"MapThread", "[", 
     RowBox[{
      RowBox[{
       RowBox[{"{", 
        RowBox[{
         RowBox[{"RandomSample", "[", 
          RowBox[{"#1", ",", "nsample"}], "]"}], ",", 
         RowBox[{"RandomSample", "[", 
          RowBox[{"#2", ",", "nsample"}], "]"}]}], "}"}], "&"}], ",", 
      RowBox[{"{", 
       RowBox[{"auxselectdistc", ",", "targetdistc"}], "}"}]}], "]"}]}], " ", 
   "\[IndentingNewLine]", ")"}], "//", 
  RowBox[{
   RowBox[{"Histogram", "/@", "#"}], "&"}]}], "\[IndentingNewLine]", 
 RowBox[{"pvalue", "=", 
  RowBox[{"Map", "[", 
   RowBox[{
    RowBox[{
     RowBox[{"Utest", "[", 
      RowBox[{
       RowBox[{"First", "@", "#"}], ",", 
       RowBox[{"Last", "@", "#"}], ",", "0"}], "]"}], "&"}], ",", 
    "randomsamples"}], " ", "]"}]}]}], "Input",
 CellChangeTimes->{{3.498284559354168*^9, 3.4982847214072523`*^9}, {
  3.498284809375807*^9, 3.4982848657387056`*^9}, {3.498445560721609*^9, 
  3.498445562983613*^9}, {3.49844643809835*^9, 3.498446454447179*^9}, {
  3.4984464907016425`*^9, 3.4984468215782237`*^9}, {3.4985284392351665`*^9, 
  3.4985286000090494`*^9}, {3.4985286511927395`*^9, 3.4985287424996996`*^9}, {
  3.4985289463452578`*^9, 3.498528978871315*^9}, {3.4985300720744348`*^9, 
  3.498530074118038*^9}}],

Cell[BoxData[{
 RowBox[{
  RowBox[{"(", 
   RowBox[{"colors", "=", 
    RowBox[{
     RowBox[{
      RowBox[{"List", "@@", "#"}], "&"}], "/@", 
     RowBox[{"{", 
      RowBox[{
      "Blue", ",", "Red", ",", "Yellow", ",", "Green", ",", "Brown", ",", 
       "Pink", ",", "Orange", ",", "Cyan", ",", "Purple", ",", "Magenta", ",",
        "LightBlue", ",", "LightBrown"}], "}"}]}]}], ")"}], " ", 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"tclusterimage", "=", 
   RowBox[{
    RowBox[{
     RowBox[{"colors", "[", 
      RowBox[{"[", 
       RowBox[{"(", 
        RowBox[{
         RowBox[{
          RowBox[{"First", "@", 
           RowBox[{"Ordering", "[", "#", "]"}]}], "&"}], "/@", 
         "targetdmatrix"}], ")"}], "]"}], "]"}], "//", 
     RowBox[{
      RowBox[{"Partition", "[", 
       RowBox[{"#", ",", "640"}], "]"}], "&"}]}], "//", "Image"}]}], " ", 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"auxclusterimage", "=", 
    RowBox[{
     RowBox[{
      RowBox[{"colors", "[", 
       RowBox[{"[", 
        RowBox[{"(", 
         RowBox[{
          RowBox[{
           RowBox[{"First", "@", 
            RowBox[{"Ordering", "[", "#", "]"}]}], "&"}], "/@", 
          "distmatrix"}], ")"}], "]"}], "]"}], "//", 
      RowBox[{
       RowBox[{"Partition", "[", 
        RowBox[{"#", ",", "640"}], "]"}], "&"}]}], "//", "Image"}]}], "  ", 
   ";"}], " "}], "\[IndentingNewLine]", 
 RowBox[{"GraphicsRow", "[", 
  RowBox[{"{", 
   RowBox[{"tclusterimage", ",", "auxclusterimage"}], "}"}], 
  "]"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"{", 
   RowBox[{
    RowBox[{"Map", "[", 
     RowBox[{
      RowBox[{
       RowBox[{"Graphics", "[", 
        RowBox[{"{", 
         RowBox[{"Black", ",", 
          RowBox[{"Inset", "[", "#", "]"}]}], "}"}], "]"}], "&"}], ",", 
      "pvalue"}], "]"}], ",", 
    RowBox[{"Map", "[", 
     RowBox[{
      RowBox[{
       RowBox[{"Graphics", "[", 
        RowBox[{"{", 
         RowBox[{
          RowBox[{"RGBColor", "@@", "#1"}], ",", 
          RowBox[{"Disk", "[", "]"}], ",", "Black"}], "}"}], "]"}], "&"}], 
      ",", "colors"}], "]"}]}], "}"}], "//", 
  RowBox[{
   RowBox[{"GraphicsGrid", "[", 
    RowBox[{"#", ",", 
     RowBox[{"ImageSize", "\[Rule]", " ", "Full"}]}], "]"}], 
   "&"}]}]}], "Input",
 CellChangeTimes->{{3.498362153204893*^9, 3.4983621670577173`*^9}, {
  3.4983622399098454`*^9, 3.4983622412826476`*^9}, {3.4984452187846084`*^9, 
  3.498445335909614*^9}, {3.4984453772808867`*^9, 3.4984454187145596`*^9}, {
  3.4984461283286057`*^9, 3.498446150979846*^9}, {3.4984462299627843`*^9, 
  3.498446360145013*^9}}],

Cell[BoxData[{
 RowBox[{
  RowBox[{"\[Alpha]", "=", "0.001"}], " "}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"anomalytrue", "=", 
   RowBox[{"Map", "[", 
    RowBox[{
     RowBox[{
      RowBox[{"#", "<", "\[Alpha]"}], "&"}], ",", "pvalue"}], "]"}]}], 
  " "}], "\[IndentingNewLine]", 
 RowBox[{"ranomalyimage", "=", 
  RowBox[{
   RowBox[{
    RowBox[{"(", 
     RowBox[{"ranomalyfeature", "=", 
      RowBox[{
       RowBox[{
        RowBox[{"If", "[", 
         RowBox[{"#", ",", "0", ",", "1"}], "]"}], "&"}], "/@", "\:3000", 
       "\[IndentingNewLine]", 
       RowBox[{"anomalytrue", "[", 
        RowBox[{"[", 
         RowBox[{"(", 
          RowBox[{
           RowBox[{
            RowBox[{"First", "@", 
             RowBox[{"Ordering", "[", "#", "]"}]}], "&"}], "/@", 
           "targetdmatrix"}], ")"}], "]"}], "]"}]}]}], ")"}], "//", 
    RowBox[{
     RowBox[{"Partition", "[", 
      RowBox[{"#", ",", "640"}], "]"}], "&"}]}], "//", "Image", 
   " "}]}]}], "Input",
 CellChangeTimes->{{3.498446969747284*^9, 3.498447058277439*^9}, {
  3.498447093533501*^9, 3.498447202811693*^9}, {3.498447300701865*^9, 
  3.4984473657695794`*^9}, {3.498448082497238*^9, 3.4984480858980446`*^9}, {
  3.4984481292505207`*^9, 3.498448185488619*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"MetaFeature", "[", 
    RowBox[{"rtarget_", ",", "raux_"}], "]"}], ":=", 
   RowBox[{"Module", "[", 
    RowBox[{
     RowBox[{"{", 
      RowBox[{
       RowBox[{"\[Alpha]", "=", "0.001"}], ",", 
       RowBox[{"k", "=", "12"}], ",", 
       RowBox[{"repeat", "=", "8"}]}], "}"}], ",", " ", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{"Print", "[", "ranomalyimage", "]"}], ";", " ", 
      "\[IndentingNewLine]", "rmetafeature"}]}], "\[IndentingNewLine]", 
    "]"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.4984474103076577`*^9, 3.4984475125346375`*^9}}]
},
WindowSize->{1016, 652},
WindowMargins->{{0, Automatic}, {Automatic, 0}},
ShowSelection->True,
FrontEndVersion->"7.0 for Microsoft Windows (64-bit) (April 23, 2009)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[545, 20, 507, 14, 72, "Input"],
Cell[1055, 36, 1021, 25, 132, "Input"],
Cell[2079, 63, 3506, 97, 212, "Input"],
Cell[5588, 162, 192, 5, 52, "Input"],
Cell[5783, 169, 129, 2, 31, "Input"],
Cell[5915, 173, 414, 11, 31, "Input"],
Cell[6332, 186, 361, 10, 31, "Input"],
Cell[6696, 198, 609, 18, 31, "Input"],
Cell[7308, 218, 706, 18, 72, "Input"],
Cell[8017, 238, 827, 15, 31, "Input"],
Cell[8847, 255, 1168, 25, 72, "Input"],
Cell[10018, 282, 121, 2, 31, "Input"],
Cell[10142, 286, 414, 10, 31, "Input"],
Cell[10559, 298, 509, 12, 31, "Input"],
Cell[11071, 312, 813, 19, 52, "Input"],
Cell[11887, 333, 858, 25, 52, "Input"],
Cell[12748, 360, 367, 11, 31, "Input"],
Cell[13118, 373, 188, 4, 52, "Input"],
Cell[13309, 379, 2253, 60, 192, "Input"],
Cell[15565, 441, 2624, 79, 132, "Input"],
Cell[18192, 522, 1254, 35, 96, "Input"],
Cell[19449, 559, 612, 16, 92, "Input"]
}
]
*)

(* End of internal cache information *)
